(function() {
	Ext.define('AppView.base.FormWin', {
		extend : 'Ext.window.Window',
		alias : 'widget.formwin',
		layout : 'fit',
		requires : ['AppView.base.BaseForm'],
		title:'添加/编辑',
		height : 400,
		width : 400,
		parentComp : null,
		viewUrl:'',
		items : [{
			xtype : 'baseform'
		}],
		buttons : [{
			text : '提交',
			formBind : true, //only enabled once the form is valid
			handler : function() {
				var parentWin = this.up('window');
				var form = parentWin.down('form').getForm();
				if (form.isValid()) {
					form.submit({
						success : function(form, action) {
							Ext.Msg.alert('提示',action.result.message);
							if(parentWin.parentComp){
								parentWin.parentComp.getStore().reload();
							}
							parentWin.close();
						},
						failure : function(form, action) {
							Ext.Msg.alert('提示',action.result.message);
						}
					});
				}
			}
		}, {
			text : '重置',
			handler : function() {
				this.up('window').down('form').getForm().reset();
			}
		}]
	})
})()